home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntinc20 / stdarg.h < prev    next >
C/C++ Source or Header  |  1992-05-15  |  992b  |  45 lines

  1. /*
  2.  * STDARG.H
  3.  */
  4.  
  5. #ifndef _STDARG_H
  6. #ifndef va_start    /* in case of varargs being included */
  7. #define    _STDARG_H
  8.  
  9. #ifndef _COMPILER_H
  10. #include <compiler.h>
  11. #endif
  12.  
  13.  
  14. typedef    __VA_LIST__ va_list;
  15.  
  16. #ifndef __GNUC__
  17.  
  18. #define va_start(list,param)  list = ((va_list) &(param)) \
  19.                    + ((sizeof(param) + 1) & ~1)
  20. #define va_arg(list,type)     ((type *)(list += ((sizeof(type) + 1) & ~1)))[-1]
  21. #define va_end(list)
  22.  
  23. #else
  24.  
  25. /* Amount of space required in an argument list for an arg of type TYPE.
  26.    TYPE may alternatively be an expression whose type is used.  */
  27.  
  28. #define __va_rounded_size(TYPE)  \
  29.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  30.  
  31. #define va_start(AP, LASTARG)                         \
  32.  (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
  33.  
  34. #define va_end(AP)
  35.  
  36. #define va_arg(AP, TYPE)                        \
  37.  (AP += __va_rounded_size (TYPE),                    \
  38.   ((TYPE *) AP)[-1])
  39.  
  40. #endif /* __GNUC__ */
  41.  
  42. #endif /* va_start */
  43.  
  44. #endif /* _STDARG_H */
  45.